<include file="Public/min-header" />
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default pull-right" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 用户{$user.nickname}信息</h3>
                </div>
                <div class="panel-body">
                    <form action="" method="post" onsubmit="return checkUserUpdate(this);" enctype="multipart/form-data">
                        <table class="table table-bordered">
                            <tbody>
                            	<tr>
                                    <td>手机号码:</td>
                                    <td>
                                        <input type="text" class="form-control" name="phone" value="{$user.phone}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')">
                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="col-sm-2">商家名称:</td>
                                    <td>
                                        <input type="text" class="form-control" name="store_name" value="{$user.store_name}">
                                        <if condition="$user['store_img']">
                                            <img src="{$user.store_img}" width="100" height="100" style="margin-top:10px;">
                                        </if>
                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td>商家LOGO：</td>
                                    <td>
                                        <input type="file" name="store_img">
                                    </td>
                                </tr>
                                <tr>
                                    <td>新密码:</td>
                                    <td>
                                        <input type="password" class="form-control" name="password">
                                    </td>
                                    <td>留空表示不修改密码</td>
                                </tr>
                                <tr>
                                    <td>确认密码:</td>
                                    <td>
                                        <input type="password" class="form-control" name="password2">
                                    </td>
                                    <td>留空表示不修改密码</td>
                                </tr>
                                <tr>
                                    <td>注册时间:</td>
                                    <td>
                                        {$user.add_time|date='Y-m-d H:i',###}
                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <button type="submit" class="btn btn-info">
                                            <i class="ace-icon fa fa-check bigger-110"></i> 保存
                                        </button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
function checkUserUpdate() {
    var email = $('input[name="email"]').val();
    var phone = $('input[name="phone"]').val();
    var password = $('input[name="password"]').val();
    var password2 = $('input[name="password2"]').val();
    var error = '';
    if (password != password2) {
        error += "两次密码不一样\n";
    }
    if (!checkEmail(email)) {
        error += "邮箱地址有误\n";
    }
    if (!checkphone(phone)) {
        error += "手机号码填写有误\n";
    }
    if (error) {
        layer.alert(error, {
            icon: 2
        });
        return false;
    }
    return true;
}
</script>
</body>
</html>
